﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;

namespace YXShop.Web.product
{
    public partial class product_bid_info : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.Form["Option"] != null && !Request.Form["Option"].Trim().Equals("")
                 && Request.Form["PrID"] != null && !Request.Form["PrID"].Trim().Equals(""))
                {
                    string types = Request.Form["Option"].Trim();
                    string ClassId = Request.Form["PrID"].Trim();
                    if (types == "Province")
                    {
                        string PrID = ClassId;
                        this.Provinces_City(PrID);
                    }
                    if (types == "Citys")
                    {
                        string PrID = ClassId;
                        this.Provinces_Borough(PrID);
                    }
                    Response.End();
                    return;
                }
                int uid = 0;
                StringBuilder cishtml = new StringBuilder();
                YXShop.BLL.Member.MemberInfo mibll = new YXShop.BLL.Member.MemberInfo();

                if (HttpContext.Current.Session["MemberID"] != null)
                {
                    uid = Convert.ToInt32(HttpContext.Current.Session["MemberID"]);
                }
                YXShop.Model.Member.MemberInfo mimodel = mibll.GetModel(uid);
                string UID = string.Empty;
                string UserName = string.Empty;
                string AddressInfo = string.Empty;
                string Tel = string.Empty;
                string Fax = string.Empty;
                string post = string.Empty;
                string MobilePhone = string.Empty;
                string Email = string.Empty;
                string Province = string.Empty;
                string City = string.Empty;
                string Borough = string.Empty;
                if (mimodel != null)
                {
                    UserName = mimodel.TrueName;
                    AddressInfo = mimodel.Address;
                    Tel = mimodel.HomePhone;
                    Fax = mimodel.Fax;
                    post = mimodel.Zip;
                    MobilePhone = mimodel.MobilePhone;
                    Province = mimodel.Province;
                    City = mimodel.City;
                    Borough = mimodel.Borough;
                }

                YXShop.BLL.Product.ProductAuction pabll = new YXShop.BLL.Product.ProductAuction();
                int productid = ChangeHope.WebPage.PageRequest.GetQueryInt("q_productid");
                YXShop.Model.Product.ProductAuction pamodel = pabll.GetModelProductID(productid);
                string Deposit = string.Empty;
                if (pamodel != null)
                {
                    Deposit = pamodel.Deposit.ToString();
                }
                string strContent = YXShop.TemplateAction.Common.YXShop_PageContent("product_bid_info");
                strContent = strContent.Replace("[#ProductID]", productid.ToString());
                strContent = strContent.Replace("[#Deposit]",Deposit);
                strContent=strContent.Replace("[#Address]",AddressInfo);
                strContent=strContent.Replace("[#Name]",UserName);
                strContent=strContent.Replace("[#Tel]",Tel);
                strContent=strContent.Replace("[#Phone]",MobilePhone);
                strContent = strContent.Replace("[#Zip]", post);
                strContent = strContent.Replace("[#Provinces]", YXShop.Common.Province.Provincess(Province));
                strContent = strContent.Replace("[#City]", YXShop.Common.Province.Provinces_City(City, Province));
                strContent = strContent.Replace("[#Borough]", YXShop.Common.Province.Provinces_Borough(Borough, City));
                Response.Write(strContent);
            }
        }

        #region Ajax省份

        #region 城
        private void Provinces_City(string idstr)
        {
            Response.Write(YXShop.Common.Province.Provinces_City("", idstr));
        }
        #endregion

        #region 区
        private void Provinces_Borough(string idstr)
        {
            Response.Write(YXShop.Common.Province.Provinces_Borough("", idstr));
        }
        #endregion
        #endregion
    }
}
